package net.flowas.genericcrud.audit;

import static net.flowas.genericcrud.rest.CrudConstant.MODEL_TYPE;

import java.util.List;
import java.util.Map;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import net.flowas.genericcrud.audit.model.AuditValue;

/**
 * 审计:访问计数、评论、收藏等
 * @author liujh
 *
 */
public interface AuditResource {
	/**
	 * 根据用户行为标记（点赞、关注、浏览计数、评论）资源
	 * @param modelType
	 * @param action
	 * @param id
	 */
	@POST
	@Path("/{modelType}/{action}/{id}")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	void mark(@PathParam(MODEL_TYPE) String modelType,@PathParam("action") String action, @PathParam("id") Long id,Map<String,Object> data);
    
	@GET
	@Path("/{modelType}/get/{id}")	
	@Produces(MediaType.APPLICATION_JSON)
	AuditValue get(@PathParam(MODEL_TYPE) String modelType,@PathParam("id") Long id);
	
	@GET
	@Path("/{modelType}/findConments/{id}")	
	@Produces(MediaType.APPLICATION_JSON)
	List<TreeWrapper> findConments(@PathParam(MODEL_TYPE) String modelType,@PathParam("id") Long id);
}
